from pyecharts.charts import WordCloud
from pyecharts import options as opts
from house_data.data_get import data_connect

data_sql = ('SELECT book_writer, book_hot FROM girl_hot_range;')
data = data_connect.seach_sql(data_sql)

wordcloud = WordCloud()
wordcloud.add(series_name='热门书籍作者',
              data_pair=data,
              word_size_range=[45,65],
              shape='pentagon'
)
wordcloud.set_global_opts(
    title_opts=opts.TitleOpts(
        title="热门书籍作者", title_textstyle_opts=opts.TextStyleOpts(font_size=23)
    ),
    tooltip_opts=opts.TooltipOpts(is_show=True),
)
wordcloud.render('../templates/gh_wordcloud.html')